<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript">
var W = frameElement._dlgargs.win, dlgcover = W.lhgdialog.gcover();
var pageConf = W.binfo.getPageConf();
function A() {
    return frameElement._dlgargs;
}
window.focus();
W.tool.regdoll(window);
document.write(W.tool.getlink('lhgdialog.css'));
if (W.binfo.ie)
{
    try {
        document.execCommand('BackgroundImageCache', false, true);
    } catch(e) {
    }
}

var recontze = function()
{
    if (W.binfo.ie && !W.binfo.i7)
    {
        $('contain').style.height = document.body.offsetHeight - 2;
        $('contain').style.width = document.body.offsetWidth - 2;
    }
    $('contain').style.height = document.body.offsetHeight-1;
    $('contain').style.width = document.body.offsetWidth-1;
    var h = $('contain').offsetHeight;
    h -= $('dtit').offsetHeight;
    h -= $('dfoot').offsetHeight;
    $('dinner').style.height = Math.max(h - 9, 0) + 'px';

};
//创建遮罩层
var crtel = function(t, l, w, h)
{
    var vpObj = frameElement.parentNode;
    if (vpObj) {
        var o = parent.document.createElement('div');
    } else {
        var o = A().topw.document.createElement('div');
    }
    W.tool.ststyle(o,
    {
        'position' : 'absolute', 'top' : t + 'px', 'left' : l + 'px', border : '1px solid #000',
        'width' : w + 'px', 'height' : h + 'px', 'zIndex' : W.config.bzi + 1, 'backgroundColor' : '#666'
    });
    W.tool.stopac(o, 0.30);

    if (vpObj) {
        vpObj.appendChild(o);
    } else {
        A().topw.document.body.appendChild(o);
    }

    return o;
};

var drag = function() {
    var regwin = [], lacoor, curpos, tdark;

    var cluphdl = function() {
        for (var i = 0; i < regwin.length; i++) {
            W.tool.remevt(regwin[i].document, 'mousemove', dragmovehdl);
            W.tool.remevt(regwin[i].document, 'mouseup', draguphdl);
        }
    };

    var dragmovehdl = function(evt) {   //onmousemove
        if (!lacoor) return;
        if (!evt) evt = W.tool.getedoc(this).parentWindow.event;

        var curcoor = { x : evt.screenX, y : evt.screenY };
        curpos =
        {
            x : curpos.x + ( curcoor.x - lacoor.x ),
            y : curpos.y + ( curcoor.y - lacoor.y )
        };
        lacoor = curcoor;
        tdark.style.left = curpos.x + 'px';
        tdark.style.top = curpos.y + 'px';
    };

    //---解决添加到平台中拖拽蒙版问题
    var getStrFromRight = function(str, i) {
        l = str.length;
        return str.substring(0, l - i);
    };
    var getActiveWinConf = function() {
        if (!W.lhgdialog.getActiveWinId()) return;
        var winConf = { w : "", h : "",t:"",l:"" };
        with (frameElement.style) {
            winConf.w = getStrFromRight(width, 2);
            winConf.h = getStrFromRight(height, 2);
            winConf.t = getStrFromRight(top, 2);
            winConf.l = getStrFromRight(left, 2)
        }
        return winConf;
    };
    var draguphdl = function(evt) {//onmouseup
        var actWinConf = getActiveWinConf();
        if (!lacoor) return;
        if (!evt) evt = W.tool.getedoc(this).parentWindow.event;
        cluphdl();
        W.tool.remnode(tdark);
        lacoor = null;
        tdark = null;
        if (curpos.y < 0) curpos.y = 0;
        if (curpos.y > pageConf.clientH - actWinConf.h) curpos.y = pageConf.clientH - actWinConf.h;
        if (curpos.x < 0) curpos.x = 0;
        if (curpos.x > pageConf.clientW - actWinConf.w) curpos.x = pageConf.clientW - actWinConf.w;
        W.tool.ststyle(frameElement, { top : curpos.y + 'px', left : curpos.x + 'px' });
        if (A().sc) {
            var tp = W.tool.getspos(A().topw);
            W.config.it = curpos.y - tp.Y;
            W.config.il = curpos.x - tp.X;
        }
        ;
    };

    return {
        downhdl : function(evt) {      //onmousedown
            var view = null;
            if (!evt) {
                view = W.tool.getedoc(this).parentWindow;
                evt = view.event;
            } else view = evt.view;
            var tget = evt.srcElement || evt.target;
            if (tget.id == 'xbtn' || tget.id == 'obtn' || tget.id == 'mbtn') return;
            var fw = frameElement.offsetWidth, fh = frameElement.offsetHeight;
            curpos = { x : frameElement.offsetLeft, y : frameElement.offsetTop };
            lacoor = { x : evt.screenX, y : evt.screenY };
            tdark = crtel(curpos.y, curpos.x, fw, fh);

            for (var i = 0; i < regwin.length; i++) {
                W.tool.addevt(regwin[i].document, 'mousemove', dragmovehdl);
                W.tool.addevt(regwin[i].document, 'mouseup', draguphdl);
            }
            if (evt.preventDefault) evt.preventDefault(); else evt.returnValue = false;
        },
        reghdl: function(w) {
            regwin.push(w);
        }
    };
}();

var resize = function() {
    var regwin = [], lacoor, curpos, tdark, frsize;
    var movehdl = function(evt) {
        if (!lacoor) return;
        if (!evt) evt = W.tool.getedoc(this).parentWindow.event;

        var curcoor = { x : evt.screenX, y : evt.screenY };
        frsize = { w : curcoor.x - lacoor.x, h : curcoor.y - lacoor.y };
        if (frsize.w < 200 || frsize.h < 100) {
            frsize.w = 200;
            frsize.h = 100
        }
        ;

        W.tool.ststyle(tdark, { width : frsize.w + 'px', height: frsize.h + 'px', top : curpos.y + 'px', left : curpos.x + 'px' });
    };

    var uphdl = function(evt) {
        if (!lacoor) return;
        if (!evt) evt = W.tool.getedoc(this).parentWindow.event;

        for (var i = 0; i < regwin.length; i++) {
            W.tool.remevt(regwin[i].document, 'mousemove', movehdl);
            W.tool.remevt(regwin[i].document, 'mouseup', uphdl);
        }

        W.tool.ststyle(frameElement, { width : frsize.w + 'px', height : frsize.h + 'px' });
        recontze();
        W.tool.remnode(tdark);
        lacoor = null;
        tdark = null;
        if (W.binfo.ie && !W.binfo.i7 && $('frmain')) $('frmain').height = $('dinner').style.height;
    };

    return {
        downhdl : function(evt) {
            var view = null;
            if (!evt) {
                view = W.tool.getedoc(this).parentWindow;
                evt = view.event;
            } else view = evt.view;

            var fw = frameElement.offsetWidth, fh = frameElement.offsetHeight;
            curpos = { x : frameElement.offsetLeft, y : frameElement.offsetTop };
            frsize = { w : fw, h : fh };
            lacoor = { x : evt.screenX - fw, y : evt.screenY - fh };
            tdark = crtel(curpos.y, curpos.x, fw, fh);

            for (var i = 0; i < regwin.length; i++) {
                W.tool.addevt(regwin[i].document, 'mousemove', movehdl);
                W.tool.addevt(regwin[i].document, 'mouseup', uphdl);
            }

            if (evt.preventDefault) evt.preventDefault(); else evt.returnValue = false;
        },

        reghdl : function(w) {
            regwin.push(w);
        }
    };
}();

(function() {
    window.onload = function() {
        recontze();
        loadbtnevt();
        $('throbber').style.visibility = '';
        loadinnfrm();
        if (W.binfo.ie) window.document.onmousedown = setop; else window.onmousedown = setop;
        $('dtit').onmousedown = drag.downhdl;
        drag.reghdl(window);
        drag.reghdl(A().topw);
        drag.reghdl(W);
        //$('dtit').onmousemove = drag.downhdl; drag.reghdl(window); drag.reghdl(A().topw); drag.reghdl(W);
        $('dark').onmousedown = resize.downhdl;
        resize.reghdl(window);
        resize.reghdl(A().topw);
        resize.reghdl(W);
        if (A().link) $('throbber').style.visibility = 'hidden';
        W.tool.disctmenu(document);
    };

    var setop = function(evt) {
        if (!evt) evt = event || this.parentWindow.event;
        W.tool.ststyle(frameElement, {'zIndex':parseInt(W.config.bzi, 10) + 1});
        W.config.bzi = frameElement.style.zIndex;
        evt.cancelBubble = true;
    };

    var loadinnfrm = function() {
        if (A().link == 'hcode') {
            $('dinner').innerHTML = A().page;
        } else {
            var sy = A().link ? '' : 'style="visibility:hidden;" ';
            $('dinner').innerHTML = '<iframe id="frmain" src="' + A().page + '" name="frmain" frameborder="0" ' +
                                    'width="100%" height="100%" scrolling="auto" ' + sy + 'allowtransparency="true"><\/iframe>';
            document.getElementById("frmain").src = A().page;   //重新刷新iframe 的 src 否则会出现页面交叉现象  王艳春
        }
    };

    window.loadinndlg = function() {
        if (!frameElement.parentNode) return null;
        var frmain = $('frmain'), innwin = frmain.contentWindow, inndoc = innwin.document;
        $('throbber').style.visibility = 'hidden';
        frmain.style.visibility = '';
        if (W.binfo.ie) inndoc.onmousedown = setop; else innwin.onmousedown = setop;
        drag.reghdl(innwin);
        resize.reghdl(innwin);
        innwin.focus();
        return W;
    };

    window.cancel = function() {
        return closedlg();
    };
    window.closedlg = function() {
        if ($('frmain')) $('frmain').src = W.tool.getvoid();
        $('throbber').style.visibility = 'hidden';
        W.lhgdialog.closdlg(window, dlgcover);
    };

    var loadbtnevt = function() {
        if (W.binfo.ie) {
            var img = new Image();
            img.src = "images/btn_close.gif";
        }
        ;
        //crebtn('cbtn', '关 闭', cancel);
        $('txt').innerHTML = A().tit;
        $('xbtn').onmouseover = function() {
            this.className = "xbtn_active_over";
        };
        $('xbtn').onmouseout = function() {
            this.className = "xbtn_active";
        };
        $('xbtn').title = "关闭";
        $('xbtn').onclick = cancel;

        var title = "";
        $('obtn').onmouseover = function() {
            if (W.lhgdialog.isMax || W.lhgdialog.isMin) {
                this.className = "obtn_active_over2";
                $('obtn').title = "还原";
            } else {
                this.className = "obtn_active_over";
                $('obtn').title = "最大化";
            }
        };
        $('obtn').onmouseout = function() {
            if (W.lhgdialog.isMax) {
                this.className = "obtn_active2";
            } else {
                this.className = "obtn_active";
            }
        };
        $('obtn').onclick = winMax;

        $('mbtn').onmouseover = function() {
//            if (W.lhgdialog.isMin) {
//                this.className = "mbtn_active_over";
//                $('mbtn').title = "还原";
//            } else {
                this.className = "mbtn_active_over";
                $('mbtn').title = "最小化";
//            }
        };
        $('mbtn').onmouseout = function() {
//            if (W.lhgdialog.isMin) {
//                this.className = "mbtn_active";
//            } else {
                this.className = "mbtn_active";
//            }
        };
        $('mbtn').onclick = winMin;

    };
    window.winMax = function() {
        W.lhgdialog.winMax(frameElement);
        recontze();
    };

    window.winMin = function() {
        W.lhgdialog.winMin(frameElement,$('obtn'));
    };

    window.hiddenwin = function() {
        W.lhgdialog.hiddendlg(frameElement);
    };

    window.showdlg = function() {
        W.lhgdialog.showdlg(frameElement);
    }

    window.crebtn = function(i, t, f) {
        if ($(i)) {
            $(i).innerHTML = '<span>' + t + '</span>';
            $(i).onclick = f;
        } else {
            var li = document.createElement('li'), span = document.createElement('span');
            li.id = i;
            span.innerHTML = t;
            li.appendChild(span);
            li.onmouseover = function() {
                this.style.backgroundPosition = '0 -42px';
            };
            li.onmouseout = function() {
                this.style.backgroundPosition = '0 -21px';
            };
            li.onclick = f;
            $('btns').appendChild(li);
            li = span = null;
        }
    };

    window.rembtn = function(id) {
        if ($(id)) $('btns').removeChild($(id));
    };

    window.remTopbtn = function(id) {
        if ($(id)) $('dtit').removeChild($(id));
    };

})();
</script>
</head>

<body>
<div id="contain" class="contain">
    <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td class="win_active_top_left"><img src="images/standard/active/bank.gif" width="4" border="0"></td>
            <td class="win_active_top_center" valign="middle">
                <div id="dtit" class="dlgtit_active">
                    <span id="txt"></span>
                    <span id="xbtn" class="xbtn_active"></span>
                    <span id="obtn" class="obtn_active"></span>
                    <span id="mbtn" class="mbtn_active"></span>
                </div>
            </td>
            <td class="win_active_top_right" width="4"></td>
        </tr>
        <tr>
            <td class="win_active_center_left"></td>
            <td class="win_active_center_center">
                <div id="dinner" class="dlginner"></div>
                <div id="dfoot" class="dlgfoot">
                    <ul id="btns">
                        <li id="dark"></li>
                    </ul>
                </div>
            </td>
            <td class="win_active_center_right"></td>
        </tr>
        <tr>
            <td class="win_active_bottom_left"></td>
            <td class="win_active_bottom_center"></td>
            <td class="win_active_bottom_right"><img src="images/standard/active/bank.gif" width="4" height="6"
                                                     border="0"></td>
        </tr>
    </table>
</div>
<div id="throbber" style="position:absolute;visibility:hidden;">正在加载窗口内容，请稍等....</div>
</body>
</html>